package com.example.emailcraft.entity.request;

import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotBlank;
import java.util.List;

@Data
public class EmailRequest {

    @NotBlank(message = "发件人邮箱不能为空")
    private String fromEmail;

    @NotBlank(message = "SMTP授权码不能为空")
    private String smtpPassword;

    @NotBlank(message = "收件人邮箱不能为空")
    private String toEmail;

    @NotBlank(message = "邮件主题不能为空")
    private String subject;

    // 二选一字段
    private String textContent;
    private String htmlContent;

    // 改为支持多个附件
    private List<MultipartFile> attachments;

    @Override
    public String toString() {
        return "EmailRequest{" +
                "fromEmail='" + fromEmail + '\'' +
                ", smtpPassword='***'" +
                ", toEmail='" + toEmail + '\'' +
                ", subject='" + subject + '\'' +
                ", attachmentsCount=" + (attachments != null ? attachments.size() : 0) +
                '}';
    }
}